import { createRouter, createWebHistory } from 'vue-router';

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login.vue')
  },
  {
    path: '/agreement',
    name: 'Agreement',
    component: () => import('@/views/agreement.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('@/views/register.vue')
  },
  {
    path: '/forgetPwd',
    name: 'ForgetPwd',
    component: () => import('@/views/forgetPwd.vue')
  },
  {
    path: '/',
    name: 'Home',
    component: () => import('@/views/home/index.vue'),
    redirect: '/findPost',
    children: [
      {
        path: 'findPost',
        name: 'FindPost',
        component: () => import('@/views/home/findPost/index.vue'),
      },
      {
        path: 'personalCenter',
        name: 'PersonalCenter',
        component: () => import('@/views/home/personalCenter.vue'),
      }
    ]
  },
  {
    path: '/findPost/history',
    name: 'FindPostHistory',
    component: () => import('@/views/home/findPost/history.vue'),
  },
  {
    path: '/findPost/detail',
    name: 'FindPostDetail',
    component: () => import('@/views/home/findPost/detail.vue'),
  },
  {
    path: '/findPost/edit',
    name: 'FindPostEdit',
    component: () => import('@/views/home/findPost/edit.vue'),
  },
  {
    path: '/setting',
    name: 'Setting',
    component: () => import('@/views/home/setting/index.vue'),
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;
